Option Explicit On 
Option Strict On
Imports System
Imports System.Object
Imports System.Collections
Imports Microsoft.VisualBasic.ControlChars

Public Class frmDistribution
    Inherits System.Windows.Forms.Form
    Public Shared oCurDistrib As New DistributorClass 'holds all the distributor info
    Private Shared oCurContact As New ContactInfo 'contact info for distributor
    Private Shared cStdOrderIndex As New Collection 'index links to std orders
    Private Shared indexDistrib As Integer = 0 'index value for Distributor to be edited
    Private Shared intTimeStyle As Integer
    Private Shared bSingleTime As Boolean
    Private Shared bRangeTime As Boolean
    Private Shared DistTimePer As New Collection
    Friend WithEvents btnCancel1 As System.Windows.Forms.Button
    Friend WithEvents btnOK1 As System.Windows.Forms.Button
    Friend WithEvents btnCancel2 As System.Windows.Forms.Button
    Friend WithEvents btnOK2 As System.Windows.Forms.Button
    Friend WithEvents btnCancel3 As System.Windows.Forms.Button
    Friend WithEvents btnOK3 As System.Windows.Forms.Button
    Friend WithEvents button_example As System.Windows.Forms.Button
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button 'time available info
    Public Shared bUpdate As Boolean

#Region " Windows Form Designer generated code "

    Public Sub New(ByVal iDistIndex As Integer)
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call
        indexDistrib = iDistIndex

    End Sub
    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents TabControl1 As System.Windows.Forms.TabControl
    Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
    Friend WithEvents TabPage1 As System.Windows.Forms.TabPage
    Friend WithEvents TabPage2 As System.Windows.Forms.TabPage
    Friend WithEvents TabPage3 As System.Windows.Forms.TabPage
    Friend WithEvents txtLiable As System.Windows.Forms.TextBox
    Friend WithEvents Label106 As System.Windows.Forms.Label
    Friend WithEvents txtResDesc As System.Windows.Forms.TextBox
    Friend WithEvents Label105 As System.Windows.Forms.Label
    Friend WithEvents btnDistrib As System.Windows.Forms.Button
    Friend WithEvents txtDistrib As System.Windows.Forms.TextBox
    Friend WithEvents Label104 As System.Windows.Forms.Label
    Friend WithEvents pnlAvail As System.Windows.Forms.Panel
    Friend WithEvents Panel20 As System.Windows.Forms.Panel
    Friend WithEvents Label110 As System.Windows.Forms.Label
    Friend WithEvents Label108 As System.Windows.Forms.Label
    Friend WithEvents txtPrereq As System.Windows.Forms.TextBox
    Friend WithEvents Label107 As System.Windows.Forms.Label
    Friend WithEvents rdoTRange As System.Windows.Forms.RadioButton
    Friend WithEvents rdoTMult As System.Windows.Forms.RadioButton
    Friend WithEvents rdoTSingle As System.Windows.Forms.RadioButton
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents lboxStandard As System.Windows.Forms.ListBox
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents txtCustom As System.Windows.Forms.TextBox
    Friend WithEvents ToolTip1 As System.Windows.Forms.ToolTip
    Friend WithEvents btnDeleteOrder As System.Windows.Forms.Button
    Friend WithEvents btnEditOrder As System.Windows.Forms.Button
    Friend WithEvents btnAddOrder As System.Windows.Forms.Button
    Friend WithEvents pnlDates As System.Windows.Forms.Panel
    Friend WithEvents btnTimeDelete As System.Windows.Forms.Button
    Friend WithEvents btnTimeEdit As System.Windows.Forms.Button
    Friend WithEvents btnTimeAdd As System.Windows.Forms.Button
    Friend WithEvents lboxTime As System.Windows.Forms.ListBox
    Friend WithEvents Label109 As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmDistribution))
        Me.TabControl1 = New System.Windows.Forms.TabControl
        Me.TabPage1 = New System.Windows.Forms.TabPage
        Me.button_example = New System.Windows.Forms.Button
        Me.btnCancel1 = New System.Windows.Forms.Button
        Me.btnOK1 = New System.Windows.Forms.Button
        Me.txtLiable = New System.Windows.Forms.TextBox
        Me.Label106 = New System.Windows.Forms.Label
        Me.txtResDesc = New System.Windows.Forms.TextBox
        Me.Label105 = New System.Windows.Forms.Label
        Me.btnDistrib = New System.Windows.Forms.Button
        Me.txtDistrib = New System.Windows.Forms.TextBox
        Me.Label104 = New System.Windows.Forms.Label
        Me.TabPage2 = New System.Windows.Forms.TabPage
        Me.Button1 = New System.Windows.Forms.Button
        Me.btnCancel2 = New System.Windows.Forms.Button
        Me.btnOK2 = New System.Windows.Forms.Button
        Me.txtCustom = New System.Windows.Forms.TextBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.btnDeleteOrder = New System.Windows.Forms.Button
        Me.btnEditOrder = New System.Windows.Forms.Button
        Me.btnAddOrder = New System.Windows.Forms.Button
        Me.lboxStandard = New System.Windows.Forms.ListBox
        Me.Label1 = New System.Windows.Forms.Label
        Me.TabPage3 = New System.Windows.Forms.TabPage
        Me.Button2 = New System.Windows.Forms.Button
        Me.btnCancel3 = New System.Windows.Forms.Button
        Me.btnOK3 = New System.Windows.Forms.Button
        Me.pnlAvail = New System.Windows.Forms.Panel
        Me.pnlDates = New System.Windows.Forms.Panel
        Me.btnTimeDelete = New System.Windows.Forms.Button
        Me.btnTimeEdit = New System.Windows.Forms.Button
        Me.btnTimeAdd = New System.Windows.Forms.Button
        Me.lboxTime = New System.Windows.Forms.ListBox
        Me.Label109 = New System.Windows.Forms.Label
        Me.Panel20 = New System.Windows.Forms.Panel
        Me.rdoTRange = New System.Windows.Forms.RadioButton
        Me.rdoTMult = New System.Windows.Forms.RadioButton
        Me.rdoTSingle = New System.Windows.Forms.RadioButton
        Me.Label110 = New System.Windows.Forms.Label
        Me.Label108 = New System.Windows.Forms.Label
        Me.txtPrereq = New System.Windows.Forms.TextBox
        Me.Label107 = New System.Windows.Forms.Label
        Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
        Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
        Me.TabControl1.SuspendLayout()
        Me.TabPage1.SuspendLayout()
        Me.TabPage2.SuspendLayout()
        Me.TabPage3.SuspendLayout()
        Me.pnlAvail.SuspendLayout()
        Me.pnlDates.SuspendLayout()
        Me.Panel20.SuspendLayout()
        Me.SuspendLayout()
        '
        'TabControl1
        '
        Me.TabControl1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.TabControl1.Controls.Add(Me.TabPage1)
        Me.TabControl1.Controls.Add(Me.TabPage2)
        Me.TabControl1.Controls.Add(Me.TabPage3)
        Me.TabControl1.ImageList = Me.ImageList1
        Me.TabControl1.Location = New System.Drawing.Point(0, 8)
        Me.TabControl1.Name = "TabControl1"
        Me.TabControl1.SelectedIndex = 0
        Me.TabControl1.Size = New System.Drawing.Size(584, 334)
        Me.TabControl1.TabIndex = 0
        Me.ToolTip1.SetToolTip(Me.TabControl1, "Describe the process for ordering the information resource." & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "Include instructions" & _
                " and advice about," & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "and special terms and services provided for," & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "the informatio" & _
                "n resource by the distributor.")
        '
        'TabPage1
        '
        Me.TabPage1.Controls.Add(Me.button_example)
        Me.TabPage1.Controls.Add(Me.btnCancel1)
        Me.TabPage1.Controls.Add(Me.btnOK1)
        Me.TabPage1.Controls.Add(Me.txtLiable)
        Me.TabPage1.Controls.Add(Me.Label106)
        Me.TabPage1.Controls.Add(Me.txtResDesc)
        Me.TabPage1.Controls.Add(Me.Label105)
        Me.TabPage1.Controls.Add(Me.btnDistrib)
        Me.TabPage1.Controls.Add(Me.txtDistrib)
        Me.TabPage1.Controls.Add(Me.Label104)
        Me.TabPage1.ImageIndex = 0
        Me.TabPage1.Location = New System.Drawing.Point(4, 23)
        Me.TabPage1.Name = "TabPage1"
        Me.TabPage1.Size = New System.Drawing.Size(576, 307)
        Me.TabPage1.TabIndex = 0
        Me.TabPage1.Text = "Distributor"
        '
        'button_example
        '
        Me.button_example.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.button_example.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.button_example.Image = Global.MetaDoc.My.Resources.Resources.app_help_48x48
        Me.button_example.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.button_example.Location = New System.Drawing.Point(458, 3)
        Me.button_example.Name = "button_example"
        Me.button_example.Size = New System.Drawing.Size(110, 48)
        Me.button_example.TabIndex = 30
        Me.button_example.Text = "EXAMPLE"
        Me.button_example.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.button_example.UseVisualStyleBackColor = True
        '
        'btnCancel1
        '
        Me.btnCancel1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnCancel1.Image = Global.MetaDoc.My.Resources.Resources.Cancel_16x16
        Me.btnCancel1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnCancel1.Location = New System.Drawing.Point(391, 278)
        Me.btnCancel1.Name = "btnCancel1"
        Me.btnCancel1.Size = New System.Drawing.Size(75, 23)
        Me.btnCancel1.TabIndex = 29
        Me.btnCancel1.Text = "Cancel"
        Me.btnCancel1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'btnOK1
        '
        Me.btnOK1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnOK1.Image = Global.MetaDoc.My.Resources.Resources.Ok_16x16
        Me.btnOK1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnOK1.Location = New System.Drawing.Point(310, 278)
        Me.btnOK1.Name = "btnOK1"
        Me.btnOK1.Size = New System.Drawing.Size(75, 23)
        Me.btnOK1.TabIndex = 28
        Me.btnOK1.Text = "OK"
        Me.btnOK1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'txtLiable
        '
        Me.txtLiable.Location = New System.Drawing.Point(16, 172)
        Me.txtLiable.Multiline = True
        Me.txtLiable.Name = "txtLiable"
        Me.txtLiable.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        Me.txtLiable.Size = New System.Drawing.Size(450, 100)
        Me.txtLiable.TabIndex = 13
        Me.ToolTip1.SetToolTip(Me.txtLiable, "statement of the liability assumed by the distributor.")
        '
        'Label106
        '
        Me.Label106.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label106.Location = New System.Drawing.Point(13, 155)
        Me.Label106.Name = "Label106"
        Me.Label106.Size = New System.Drawing.Size(187, 23)
        Me.Label106.TabIndex = 12
        Me.Label106.Text = "Distribution Liability"
        Me.ToolTip1.SetToolTip(Me.Label106, "statement of the liability assumed by the distributor.")
        '
        'txtResDesc
        '
        Me.txtResDesc.Location = New System.Drawing.Point(16, 52)
        Me.txtResDesc.Multiline = True
        Me.txtResDesc.Name = "txtResDesc"
        Me.txtResDesc.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        Me.txtResDesc.Size = New System.Drawing.Size(450, 100)
        Me.txtResDesc.TabIndex = 11
        Me.ToolTip1.SetToolTip(Me.txtResDesc, " the identifier by which the distributor knows the data set. ")
        '
        'Label105
        '
        Me.Label105.Location = New System.Drawing.Point(13, 37)
        Me.Label105.Name = "Label105"
        Me.Label105.Size = New System.Drawing.Size(120, 23)
        Me.Label105.TabIndex = 10
        Me.Label105.Text = "Resource Description"
        Me.ToolTip1.SetToolTip(Me.Label105, " the identifier by which the distributor knows the data set. ")
        '
        'btnDistrib
        '
        Me.btnDistrib.Image = Global.MetaDoc.My.Resources.Resources.file_edit_16x16
        Me.btnDistrib.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnDistrib.Location = New System.Drawing.Point(318, 9)
        Me.btnDistrib.Name = "btnDistrib"
        Me.btnDistrib.Size = New System.Drawing.Size(75, 23)
        Me.btnDistrib.TabIndex = 9
        Me.btnDistrib.Text = "Edit"
        Me.ToolTip1.SetToolTip(Me.btnDistrib, resources.GetString("btnDistrib.ToolTip"))
        '
        'txtDistrib
        '
        Me.txtDistrib.Location = New System.Drawing.Point(82, 11)
        Me.txtDistrib.Name = "txtDistrib"
        Me.txtDistrib.ReadOnly = True
        Me.txtDistrib.Size = New System.Drawing.Size(230, 20)
        Me.txtDistrib.TabIndex = 8
        Me.txtDistrib.TabStop = False
        Me.ToolTip1.SetToolTip(Me.txtDistrib, resources.GetString("txtDistrib.ToolTip"))
        '
        'Label104
        '
        Me.Label104.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label104.Location = New System.Drawing.Point(13, 14)
        Me.Label104.Name = "Label104"
        Me.Label104.Size = New System.Drawing.Size(100, 23)
        Me.Label104.TabIndex = 7
        Me.Label104.Text = "Distributor"
        Me.ToolTip1.SetToolTip(Me.Label104, resources.GetString("Label104.ToolTip"))
        '
        'TabPage2
        '
        Me.TabPage2.AutoScroll = True
        Me.TabPage2.Controls.Add(Me.Button1)
        Me.TabPage2.Controls.Add(Me.btnCancel2)
        Me.TabPage2.Controls.Add(Me.btnOK2)
        Me.TabPage2.Controls.Add(Me.txtCustom)
        Me.TabPage2.Controls.Add(Me.Label2)
        Me.TabPage2.Controls.Add(Me.btnDeleteOrder)
        Me.TabPage2.Controls.Add(Me.btnEditOrder)
        Me.TabPage2.Controls.Add(Me.btnAddOrder)
        Me.TabPage2.Controls.Add(Me.lboxStandard)
        Me.TabPage2.Controls.Add(Me.Label1)
        Me.TabPage2.ImageIndex = 1
        Me.TabPage2.Location = New System.Drawing.Point(4, 23)
        Me.TabPage2.Name = "TabPage2"
        Me.TabPage2.Size = New System.Drawing.Size(576, 307)
        Me.TabPage2.TabIndex = 1
        Me.TabPage2.Text = "Ordering"
        '
        'Button1
        '
        Me.Button1.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.Button1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Button1.Image = Global.MetaDoc.My.Resources.Resources.app_help_48x48
        Me.Button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.Button1.Location = New System.Drawing.Point(458, 3)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(110, 48)
        Me.Button1.TabIndex = 31
        Me.Button1.Text = "EXAMPLE"
        Me.Button1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.Button1.UseVisualStyleBackColor = True
        '
        'btnCancel2
        '
        Me.btnCancel2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnCancel2.Image = Global.MetaDoc.My.Resources.Resources.Cancel_16x16
        Me.btnCancel2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnCancel2.Location = New System.Drawing.Point(386, 228)
        Me.btnCancel2.Name = "btnCancel2"
        Me.btnCancel2.Size = New System.Drawing.Size(75, 23)
        Me.btnCancel2.TabIndex = 29
        Me.btnCancel2.Text = "Cancel"
        Me.btnCancel2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'btnOK2
        '
        Me.btnOK2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnOK2.Image = Global.MetaDoc.My.Resources.Resources.Ok_16x16
        Me.btnOK2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnOK2.Location = New System.Drawing.Point(305, 228)
        Me.btnOK2.Name = "btnOK2"
        Me.btnOK2.Size = New System.Drawing.Size(75, 23)
        Me.btnOK2.TabIndex = 28
        Me.btnOK2.Text = "OK"
        Me.btnOK2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'txtCustom
        '
        Me.txtCustom.AcceptsReturn = True
        Me.txtCustom.Location = New System.Drawing.Point(11, 122)
        Me.txtCustom.Multiline = True
        Me.txtCustom.Name = "txtCustom"
        Me.txtCustom.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        Me.txtCustom.Size = New System.Drawing.Size(450, 100)
        Me.txtCustom.TabIndex = 6
        Me.ToolTip1.SetToolTip(Me.txtCustom, resources.GetString("txtCustom.ToolTip"))
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(8, 105)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(128, 23)
        Me.Label2.TabIndex = 5
        Me.Label2.Text = "Custom Order Process"
        Me.ToolTip1.SetToolTip(Me.Label2, resources.GetString("Label2.ToolTip"))
        '
        'btnDeleteOrder
        '
        Me.btnDeleteOrder.Enabled = False
        Me.btnDeleteOrder.Image = Global.MetaDoc.My.Resources.Resources.file_del_16x16
        Me.btnDeleteOrder.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnDeleteOrder.Location = New System.Drawing.Point(206, 76)
        Me.btnDeleteOrder.Name = "btnDeleteOrder"
        Me.btnDeleteOrder.Size = New System.Drawing.Size(75, 23)
        Me.btnDeleteOrder.TabIndex = 4
        Me.btnDeleteOrder.Text = "Delete"
        '
        'btnEditOrder
        '
        Me.btnEditOrder.Enabled = False
        Me.btnEditOrder.Image = Global.MetaDoc.My.Resources.Resources.file_edit_16x16
        Me.btnEditOrder.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnEditOrder.Location = New System.Drawing.Point(125, 76)
        Me.btnEditOrder.Name = "btnEditOrder"
        Me.btnEditOrder.Size = New System.Drawing.Size(75, 23)
        Me.btnEditOrder.TabIndex = 3
        Me.btnEditOrder.Text = "Edit"
        '
        'btnAddOrder
        '
        Me.btnAddOrder.Image = Global.MetaDoc.My.Resources.Resources.file_new_16x16
        Me.btnAddOrder.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnAddOrder.Location = New System.Drawing.Point(44, 76)
        Me.btnAddOrder.Name = "btnAddOrder"
        Me.btnAddOrder.Size = New System.Drawing.Size(75, 23)
        Me.btnAddOrder.TabIndex = 2
        Me.btnAddOrder.Text = "Add"
        '
        'lboxStandard
        '
        Me.lboxStandard.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.lboxStandard.Location = New System.Drawing.Point(11, 31)
        Me.lboxStandard.Name = "lboxStandard"
        Me.lboxStandard.Size = New System.Drawing.Size(270, 39)
        Me.lboxStandard.TabIndex = 1
        Me.ToolTip1.SetToolTip(Me.lboxStandard, "the common ways in which the data set may be obtained or received," & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "and related i" & _
                "nstructions and fee information. ")
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(8, 14)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(136, 23)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Standard Order Process"
        Me.ToolTip1.SetToolTip(Me.Label1, "the common ways in which the data set may be obtained or received," & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "and related i" & _
                "nstructions and fee information. ")
        '
        'TabPage3
        '
        Me.TabPage3.Controls.Add(Me.Button2)
        Me.TabPage3.Controls.Add(Me.btnCancel3)
        Me.TabPage3.Controls.Add(Me.btnOK3)
        Me.TabPage3.Controls.Add(Me.pnlAvail)
        Me.TabPage3.Controls.Add(Me.txtPrereq)
        Me.TabPage3.Controls.Add(Me.Label107)
        Me.TabPage3.ImageIndex = 2
        Me.TabPage3.Location = New System.Drawing.Point(4, 23)
        Me.TabPage3.Name = "TabPage3"
        Me.TabPage3.Size = New System.Drawing.Size(576, 307)
        Me.TabPage3.TabIndex = 2
        Me.TabPage3.Text = "Prerequisites & Availability"
        '
        'Button2
        '
        Me.Button2.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.Button2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Button2.Image = Global.MetaDoc.My.Resources.Resources.app_help_48x48
        Me.Button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.Button2.Location = New System.Drawing.Point(458, 3)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(110, 48)
        Me.Button2.TabIndex = 31
        Me.Button2.Text = "EXAMPLE"
        Me.Button2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.Button2.UseVisualStyleBackColor = True
        '
        'btnCancel3
        '
        Me.btnCancel3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnCancel3.Image = Global.MetaDoc.My.Resources.Resources.Cancel_16x16
        Me.btnCancel3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnCancel3.Location = New System.Drawing.Point(420, 271)
        Me.btnCancel3.Name = "btnCancel3"
        Me.btnCancel3.Size = New System.Drawing.Size(75, 23)
        Me.btnCancel3.TabIndex = 27
        Me.btnCancel3.Text = "Cancel"
        Me.btnCancel3.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'btnOK3
        '
        Me.btnOK3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnOK3.Image = Global.MetaDoc.My.Resources.Resources.Ok_16x16
        Me.btnOK3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnOK3.Location = New System.Drawing.Point(339, 271)
        Me.btnOK3.Name = "btnOK3"
        Me.btnOK3.Size = New System.Drawing.Size(75, 23)
        Me.btnOK3.TabIndex = 26
        Me.btnOK3.Text = "OK"
        Me.btnOK3.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'pnlAvail
        '
        Me.pnlAvail.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.pnlAvail.Controls.Add(Me.pnlDates)
        Me.pnlAvail.Controls.Add(Me.Panel20)
        Me.pnlAvail.Controls.Add(Me.Label110)
        Me.pnlAvail.Controls.Add(Me.Label108)
        Me.pnlAvail.Location = New System.Drawing.Point(11, 117)
        Me.pnlAvail.Name = "pnlAvail"
        Me.pnlAvail.Size = New System.Drawing.Size(484, 148)
        Me.pnlAvail.TabIndex = 25
        Me.pnlAvail.TabStop = True
        Me.ToolTip1.SetToolTip(Me.pnlAvail, "the time period when the data set will be available from the distributor.")
        '
        'pnlDates
        '
        Me.pnlDates.Controls.Add(Me.btnTimeDelete)
        Me.pnlDates.Controls.Add(Me.btnTimeEdit)
        Me.pnlDates.Controls.Add(Me.btnTimeAdd)
        Me.pnlDates.Controls.Add(Me.lboxTime)
        Me.pnlDates.Controls.Add(Me.Label109)
        Me.pnlDates.Location = New System.Drawing.Point(188, 26)
        Me.pnlDates.Name = "pnlDates"
        Me.pnlDates.Size = New System.Drawing.Size(283, 109)
        Me.pnlDates.TabIndex = 18
        Me.pnlDates.TabStop = True
        '
        'btnTimeDelete
        '
        Me.btnTimeDelete.Enabled = False
        Me.btnTimeDelete.Image = Global.MetaDoc.My.Resources.Resources.file_del_16x16
        Me.btnTimeDelete.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnTimeDelete.Location = New System.Drawing.Point(199, 78)
        Me.btnTimeDelete.Name = "btnTimeDelete"
        Me.btnTimeDelete.Size = New System.Drawing.Size(75, 23)
        Me.btnTimeDelete.TabIndex = 35
        Me.btnTimeDelete.Text = "Delete"
        '
        'btnTimeEdit
        '
        Me.btnTimeEdit.Enabled = False
        Me.btnTimeEdit.Image = Global.MetaDoc.My.Resources.Resources.file_edit_16x16
        Me.btnTimeEdit.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnTimeEdit.Location = New System.Drawing.Point(118, 78)
        Me.btnTimeEdit.Name = "btnTimeEdit"
        Me.btnTimeEdit.Size = New System.Drawing.Size(75, 23)
        Me.btnTimeEdit.TabIndex = 34
        Me.btnTimeEdit.Text = "Edit"
        '
        'btnTimeAdd
        '
        Me.btnTimeAdd.Image = Global.MetaDoc.My.Resources.Resources.file_new_16x16
        Me.btnTimeAdd.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnTimeAdd.Location = New System.Drawing.Point(37, 78)
        Me.btnTimeAdd.Name = "btnTimeAdd"
        Me.btnTimeAdd.Size = New System.Drawing.Size(75, 23)
        Me.btnTimeAdd.TabIndex = 33
        Me.btnTimeAdd.Text = "Add"
        '
        'lboxTime
        '
        Me.lboxTime.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.lboxTime.Location = New System.Drawing.Point(4, 33)
        Me.lboxTime.Name = "lboxTime"
        Me.lboxTime.Size = New System.Drawing.Size(270, 39)
        Me.lboxTime.TabIndex = 32
        Me.ToolTip1.SetToolTip(Me.lboxTime, "the time period when the data set will be available from the distributor.")
        '
        'Label109
        '
        Me.Label109.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label109.Location = New System.Drawing.Point(3, 7)
        Me.Label109.Name = "Label109"
        Me.Label109.Size = New System.Drawing.Size(96, 23)
        Me.Label109.TabIndex = 31
        Me.Label109.Text = "Time Period(s):"
        Me.Label109.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.ToolTip1.SetToolTip(Me.Label109, "the time period when the data set will be available from the distributor.")
        '
        'Panel20
        '
        Me.Panel20.Controls.Add(Me.rdoTRange)
        Me.Panel20.Controls.Add(Me.rdoTMult)
        Me.Panel20.Controls.Add(Me.rdoTSingle)
        Me.Panel20.Location = New System.Drawing.Point(70, 26)
        Me.Panel20.Name = "Panel20"
        Me.Panel20.Size = New System.Drawing.Size(109, 88)
        Me.Panel20.TabIndex = 17
        Me.Panel20.TabStop = True
        Me.ToolTip1.SetToolTip(Me.Panel20, "the time period when the data set will be available from the distributor.")
        '
        'rdoTRange
        '
        Me.rdoTRange.Location = New System.Drawing.Point(8, 56)
        Me.rdoTRange.Name = "rdoTRange"
        Me.rdoTRange.Size = New System.Drawing.Size(112, 24)
        Me.rdoTRange.TabIndex = 2
        Me.rdoTRange.TabStop = True
        Me.rdoTRange.Text = "A range of dates"
        '
        'rdoTMult
        '
        Me.rdoTMult.Location = New System.Drawing.Point(8, 32)
        Me.rdoTMult.Name = "rdoTMult"
        Me.rdoTMult.Size = New System.Drawing.Size(104, 24)
        Me.rdoTMult.TabIndex = 1
        Me.rdoTMult.TabStop = True
        Me.rdoTMult.Text = "Multiple dates"
        '
        'rdoTSingle
        '
        Me.rdoTSingle.Location = New System.Drawing.Point(8, 8)
        Me.rdoTSingle.Name = "rdoTSingle"
        Me.rdoTSingle.Size = New System.Drawing.Size(96, 24)
        Me.rdoTSingle.TabIndex = 0
        Me.rdoTSingle.TabStop = True
        Me.rdoTSingle.Text = "A single date"
        '
        'Label110
        '
        Me.Label110.Location = New System.Drawing.Point(3, 23)
        Me.Label110.Name = "Label110"
        Me.Label110.Size = New System.Drawing.Size(72, 32)
        Me.Label110.TabIndex = 16
        Me.Label110.Text = "Data will be available"
        Me.Label110.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'Label108
        '
        Me.Label108.Dock = System.Windows.Forms.DockStyle.Top
        Me.Label108.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label108.Location = New System.Drawing.Point(0, 0)
        Me.Label108.Name = "Label108"
        Me.Label108.Size = New System.Drawing.Size(480, 23)
        Me.Label108.TabIndex = 4
        Me.Label108.Text = "Available Time Period (optional)"
        Me.Label108.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        Me.ToolTip1.SetToolTip(Me.Label108, "the time period when the data set will be available from the distributor.")
        '
        'txtPrereq
        '
        Me.txtPrereq.Location = New System.Drawing.Point(11, 31)
        Me.txtPrereq.Multiline = True
        Me.txtPrereq.Name = "txtPrereq"
        Me.txtPrereq.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        Me.txtPrereq.Size = New System.Drawing.Size(441, 75)
        Me.txtPrereq.TabIndex = 23
        Me.ToolTip1.SetToolTip(Me.txtPrereq, "description of any technical capabilities that the consumer must have to" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "use the" & _
                " data set in the form(s) provided by the distributor. ")
        '
        'Label107
        '
        Me.Label107.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label107.Location = New System.Drawing.Point(8, 14)
        Me.Label107.Name = "Label107"
        Me.Label107.Size = New System.Drawing.Size(184, 23)
        Me.Label107.TabIndex = 22
        Me.Label107.Text = "Technical Prerequisites (optional)"
        Me.ToolTip1.SetToolTip(Me.Label107, "description of any technical capabilities that the consumer must have to" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "use the" & _
                " data set in the form(s) provided by the distributor. ")
        '
        'ImageList1
        '
        Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
        Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
        Me.ImageList1.Images.SetKeyName(0, "field_MAN.png")
        Me.ImageList1.Images.SetKeyName(1, "field_MIA.png")
        Me.ImageList1.Images.SetKeyName(2, "field_OPT.png")
        Me.ImageList1.Images.SetKeyName(3, "")
        Me.ImageList1.Images.SetKeyName(4, "")
        Me.ImageList1.Images.SetKeyName(5, "")
        '
        'ToolTip1
        '
        Me.ToolTip1.IsBalloon = True
        Me.ToolTip1.ShowAlways = True
        Me.ToolTip1.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info
        '
        'frmDistribution
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.AutoScroll = True
        Me.ClientSize = New System.Drawing.Size(584, 363)
        Me.ControlBox = False
        Me.Controls.Add(Me.TabControl1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Name = "frmDistribution"
        Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Distribution Information"
        Me.ToolTip1.SetToolTip(Me, "Distribution Information -- information about the distributor of and options for " & _
                "obtaining the data set. ")
        Me.TabControl1.ResumeLayout(False)
        Me.TabPage1.ResumeLayout(False)
        Me.TabPage1.PerformLayout()
        Me.TabPage2.ResumeLayout(False)
        Me.TabPage2.PerformLayout()
        Me.TabPage3.ResumeLayout(False)
        Me.TabPage3.PerformLayout()
        Me.pnlAvail.ResumeLayout(False)
        Me.pnlDates.ResumeLayout(False)
        Me.Panel20.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub frmDistribution_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        oCurDistrib = New DistributorClass
        bUpdate = False
        intTimeStyle = frmMain.getTimeStyle()
        If (indexDistrib > 0) Then
            oCurDistrib = CType(frmMain.f61.getDistrib()(indexDistrib), DistributorClass)
        End If

        'set up the distributor's contact info
        Dim s1 As String = ""
        oCurContact = oCurDistrib.Distributor
        If (oCurContact.PrimaryPerson = True) Then
            s1 = "Contact Person: " & oCurContact.Person
        Else
            s1 = "Contact Organization: " & oCurContact.Organization
        End If
        txtDistrib.Text = s1

        'retrieve other information from Distributor object, put in form
        'when appropriate
        With oCurDistrib
            txtResDesc.Text = .ResourceDesc
            txtLiable.Text = .Liability
            cStdOrderIndex = .StdOrderColl
            txtCustom.Text = .CustomOrder
            txtPrereq.Text = .TechReq
            bSingleTime = .boolSingle
            bRangeTime = .boolRange
            DistTimePer = .TimeAvail
        End With

        Dim iCount As Integer = 0
        Dim iLoop As Integer = 0
        rdoTSingle.Checked = False
        rdoTMult.Checked = False
        rdoTRange.Checked = False
        lboxTime.Items.Clear()
        pnlDates.Enabled = False 'cannot enter dates until single|multiple|range chosen
        If (bSingleTime = True) Then 'set up date type: single, multiple, or range
            If (bRangeTime = False) Then
                rdoTSingle.Checked = True
                pnlDates.Enabled = True
            Else
                rdoTMult.Checked = True
                pnlDates.Enabled = True
            End If
        Else
            If (bRangeTime = True) Then
                rdoTRange.Checked = True
                pnlDates.Enabled = True
            Else
            End If
        End If
        iCount = DistTimePer.Count 'get number of times to load into list box; 1-based index
        If (rdoTRange.Checked = False) Then
            Dim dSingle As New SngDateTime 'add single or multiple date/time
            For iLoop = 1 To iCount
                dSingle = CType(DistTimePer(iLoop), SngDateTime)
                s1 = dSingle.SngDate & "  " & dSingle.TimeOfDay
                lboxTime.Items.Add(s1)
            Next
        Else
            Dim dBegin As New SngDateTime     'add date/time range
            Dim dEnding As New SngDateTime
            For iLoop = 1 To iCount Step 2
                dBegin = CType(DistTimePer(iLoop), SngDateTime)
                dEnding = CType(DistTimePer(iLoop + 1), SngDateTime)
                s1 = "begin: " & dBegin.SngDate & "  " & "end: " & dEnding.SngDate
                lboxTime.Items.Add(s1)
            Next
        End If

        'populate the Standard Order Process list box
        lboxStandard.Items.Clear() 'initialize the list box
        iCount = cStdOrderIndex.Count 'get number of order processes
        Dim oStandard As New StdOrderClass
        Dim iVal As Integer = 0 'current index value
        For iLoop = 1 To iCount
            iVal = CType(cStdOrderIndex(iLoop), Integer) 'retrieve index value
            oStandard = CType(frmMain.f61.getStdOrderProc()(iVal), StdOrderClass) 'retrieve std order
            If (oStandard.NonDigitalForm <> "") Then
                s1 = "Non-digital form: " & Microsoft.VisualBasic.Left(oStandard.NonDigitalForm, 30)
                s1 += "  Fees: " & oStandard.Fees
            ElseIf (oStandard.DigitalForms.Count > 0) Then
                s1 = "Digital form: " & oStandard.DigitalForms.Count & " digital formats"
                s1 += "  Fees: " & oStandard.Fees
            Else
                s1 = "Unspecified form!  " & "  Fees: " & oStandard.Fees
            End If
            lboxStandard.Items.Add(s1)
        Next
    End Sub

    Private Sub btnContact_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDistrib.Click
        Dim iConType As Integer = 0
        Dim frmPStepcontact As frmContact
        If (txtDistrib.Text = "") Then
            frmPStepcontact = New frmContact(oCurContact, 1)
        Else
            frmPStepcontact = New frmContact(oCurContact, 2)
        End If
        frmPStepcontact.ShowDialog()
        If (frmPStepcontact.getUpdated() = True) Then
            oCurContact = frmPStepcontact.getConInfo() 'update the contact object
            If (oCurContact.PrimaryPerson = True) Then 'update the form display
                txtDistrib.Text = oCurContact.Person
            Else
                txtDistrib.Text = oCurContact.Organization
            End If
        End If
    End Sub

    Private Sub btnAddOrder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddOrder.Click
        Dim s1 As String = ""
        Dim iCount As Integer = 0
        Dim oNewOrder As New StdOrderClass
        Dim frmNewOrder As New frmStdOrder(oNewOrder)
        frmNewOrder.ShowDialog()
        If (frmNewOrder.getUpdated() = True) Then
            oNewOrder = frmNewOrder.getStdOrder()
            frmMain.f61.addStdOrderProc(oNewOrder) 'add new order process to main collection
            iCount = frmMain.f61.getStdOrderProc().Count 'count is also index value of most recent addition
            cStdOrderIndex.Add(iCount) 'add index value to collection
            If (oNewOrder.NonDigitalForm <> "") Then
                s1 = "Non-digital form: " & Microsoft.VisualBasic.Left(oNewOrder.NonDigitalForm, 30)
                s1 += "  Fees: " & oNewOrder.Fees
            ElseIf (oNewOrder.DigitalForms.Count > 0) Then
                s1 = "Digital form: " & oNewOrder.DigitalForms.Count & " digital formats"
                s1 += "  Fees: " & oNewOrder.Fees
            Else
                s1 = "Unspecified form!  " & "  Fees: " & oNewOrder.Fees
            End If
            lboxStandard.Items.Add(s1)
        End If
    End Sub

    Private Sub btnEditOrder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEditOrder.Click
        Dim indexVal As Integer = lboxStandard.SelectedIndex
        Dim iCount As Integer = lboxStandard.Items.Count
        Dim s1 As String = ""
        If (indexVal = -1) Then
            If (iCount = 0) Then
                s1 = "No Standard Order Process available for editing."
                MessageBox.Show(s1, "Selection error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Return
            ElseIf (iCount = 1) Then
                indexVal = 0
            Else
                s1 = "No Standard Order Process chosen for editing."
                MessageBox.Show(s1, "Selection error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Return
            End If
        End If

        Dim oEditOrder As New StdOrderClass
        Dim iOrder As Integer = CType(cStdOrderIndex(indexVal + 1), Integer)
        oEditOrder = CType(frmMain.f61.getStdOrderProc()(iOrder), StdOrderClass) 'retrieve process to edit
        Dim frmEditOrder As New frmStdOrder(oEditOrder)
        frmEditOrder.ShowDialog()
        If (frmEditOrder.getUpdated() = True) Then
            oEditOrder = frmEditOrder.getStdOrder()
            frmMain.f61.addStdOrderProc(oEditOrder, indexVal + 1) 'insert edited process into collection
            frmMain.f61.removeStdOrderProc(indexVal + 2) 'remove old version; 1-based index
            'index value collection is unchanged
            If (oEditOrder.NonDigitalForm <> "") Then
                s1 = "Non-digital form: " & Microsoft.VisualBasic.Left(oEditOrder.NonDigitalForm, 30)
                s1 += "  Fees: " & oEditOrder.Fees
            ElseIf (oEditOrder.DigitalForms.Count > 0) Then
                s1 = "Digital form: " & oEditOrder.DigitalForms.Count & " digital formats"
                s1 += "  Fees: " & oEditOrder.Fees
            Else
                s1 = "Unspecified form!  " & "  Fees: " & oEditOrder.Fees
            End If
            lboxStandard.Items.Insert(indexVal, s1) 'insert new version of identifier
            lboxStandard.Items.RemoveAt(indexVal + 1) 'remove old identifier; 0-based index
        End If
        btnEditOrder.Enabled = False : btnDeleteOrder.Enabled = False
    End Sub

    Private Sub btnDeleteOrder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDeleteOrder.Click
        Dim indexVal As Integer = lboxStandard.SelectedIndex
        Dim s1 As String = ""
        If (indexVal = -1) Then
            s1 = "No Standard Order Process chosen for deletion."
            MessageBox.Show(s1, "Selection error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Return
        End If

        cStdOrderIndex.Remove(indexVal + 1) '1-based collection of index values
        lboxStandard.Items.RemoveAt(indexVal) '0-based collection in list box
        'note that the main collection of standard order processes is NOT modified,
        'thereby eliminating the need to update all other index values

        btnEditOrder.Enabled = False : btnDeleteOrder.Enabled = False
    End Sub

    Private Sub lboxStandard_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lboxStandard.SelectedIndexChanged
        If lboxStandard.SelectedItems.Count() > 0 Then btnEditOrder.Enabled = True : btnDeleteOrder.Enabled = True Else btnEditOrder.Enabled = False : btnDeleteOrder.Enabled = False
    End Sub

#Region " Handling routines for Available Time Period sub-panel "

    Private Sub checkAdd()
        If (rdoTSingle.Checked Or rdoTRange.Checked) And lboxTime.Items.Count >= 1 Then btnTimeAdd.Enabled = False Else btnTimeAdd.Enabled = True
    End Sub

    Private Sub btnTimeAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTimeAdd.Click
        Dim iCount As Integer = DistTimePer.Count
        Dim strNewDate As String = ""
        'process Gregorian dates for data set availability
        If (rdoTSingle.Checked = True And iCount = 1) Then
            MessageBox.Show("Can't add another date to single date/time", "Add date error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Return
        End If
        If (rdoTRange.Checked = False) Then  'add and update 1 date/time
            Dim dSingle As New SngDateTime
            Dim frmTDate As New frmTimePeriod(intTimeStyle, dSingle)
            frmTDate.ShowDialog()
            If (frmTDate.getChanged() = False) Then
            Else
                dSingle = frmTDate.getBegDate()
                DistTimePer.Add(dSingle)
                strNewDate = dSingle.SngDate & "  " & dSingle.TimeOfDay
                lboxTime.Items.Add(strNewDate)
            End If
        Else
            If (rdoTRange.Checked = True And iCount > 1) Then
                MessageBox.Show("Can only have 1 date range.", "Add date range error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Return
            End If
            Dim dBegin As New SngDateTime     'add and update date/time range
            Dim dEnding As New SngDateTime
            Dim frmTDate As New frmTimePeriod(intTimeStyle, dBegin, dEnding)
            frmTDate.ShowDialog()
            If (frmTDate.getChanged() = False) Then
            Else
                dBegin = frmTDate.getBegDate()
                dEnding = frmTDate.getEndDate()
                DistTimePer.Add(dBegin)
                DistTimePer.Add(dEnding)
                strNewDate = "begin: " & dBegin.SngDate & "  " & "end: " & dEnding.SngDate
                lboxTime.Items.Add(strNewDate)
            End If
        End If
        checkAdd()
    End Sub

    Private Sub btnTimeEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTimeEdit.Click
        Dim iCount As Integer = DistTimePer.Count
        Dim iToEdit1 As Integer = 0
        Dim iToEdit2 As Integer = 0
        Dim iToRemove As Integer = 0
        Dim strNewDate As String = ""
        Dim strError As String = ""

        btnTimeEdit.Enabled = False
        btnTimeDelete.Enabled = False
        checkAdd()

        If (iCount = 0) Then 'Edit button pressed by mistake -- no entries to edit
            strError = "There are no Time Period entries to edit."
            MessageBox.Show(strError, "Selection error", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Return
        End If
        'Gregorian dates section
        If (rdoTSingle.Checked = True) Then 'Edits a single date
            Dim dSingle As New SngDateTime
            dSingle = CType(DistTimePer(1), SngDateTime)
            Dim frmTDate1 As New frmTimePeriod(intTimeStyle, dSingle)
            frmTDate1.ShowDialog()
            If (frmTDate1.getChanged() = False) Then 'update was cancelled
            Else
                dSingle = frmTDate1.getBegDate()          'get updated single date/time
                DistTimePer.Remove(1)                  'clear existing single date/time
                lboxTime.Items.Clear()
                DistTimePer.Add(dSingle)               'add updated single date/time to collection and form
                strNewDate = dSingle.SngDate & "  " & dSingle.TimeOfDay
                lboxTime.Items.Add(strNewDate)
            End If
            Return
        End If
        If (rdoTMult.Checked = True) Then  'Edits member of multiple date/time collection
            Dim dSingle As New SngDateTime
            iToEdit1 = lboxTime.SelectedIndex 'zero-based index
            If (iToEdit1 = -1) Then
                strError = "One of the Time Period entries must be selected for editing."
                MessageBox.Show(strError, "Date editing selection error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Return
            End If
            dSingle = CType(DistTimePer(iToEdit1 + 1), SngDateTime) 'collection is one-based index
            Dim frmTDate2 As New frmTimePeriod(intTimeStyle, dSingle)
            frmTDate2.ShowDialog()
            If (frmTDate2.getChanged() = False) Then 'update was cancelled
            Else
                dSingle = frmTDate2.getBegDate()             'get updated date/time entry
                DistTimePer.Add(dSingle, , iToEdit1 + 1)  'add to collection before original version of entry
                DistTimePer.Remove(iToEdit1 + 2)          'remove old version of entry from collection
                strNewDate = dSingle.SngDate & "  " & dSingle.TimeOfDay
                lboxTime.Items.Insert(iToEdit1, strNewDate)  'insert edited entry into listbox
                lboxTime.Items.RemoveAt(iToEdit1 + 1)        'remove old version from listbox
            End If
            Return
        End If
        If (rdoTRange.Checked = True) Then     'Edits a date/time range
            Dim dBegin As New SngDateTime
            Dim dEnding As New SngDateTime
            dBegin = CType(DistTimePer(1), SngDateTime)
            dEnding = CType(DistTimePer(2), SngDateTime)
            Dim frmTDate As New frmTimePeriod(intTimeStyle, dBegin, dEnding)
            frmTDate.ShowDialog()
            If (frmTDate.getChanged() = False) Then 'update was cancelled
            Else
                dBegin = frmTDate.getBegDate()            'get updated date/time range
                dEnding = frmTDate.getEndDate()
                DistTimePer.Remove(2)                  'remove old range entries from collection and listbox
                DistTimePer.Remove(1)
                lboxTime.Items.Clear()
                DistTimePer.Add(dBegin)                 'add new range entries to collection and listbox
                DistTimePer.Add(dEnding)
                strNewDate = "begin: " & dBegin.SngDate & "  " & "end: " & dEnding.SngDate
                lboxTime.Items.Add(strNewDate)
            End If
            Return
        End If
    End Sub

    Private Sub btnTimeDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTimeDelete.Click
        Dim iCount As Integer = DistTimePer.Count
        Dim iToRemove As Integer = 0

        btnTimeEdit.Enabled = False
        btnTimeDelete.Enabled = False

        If (iCount = 0) Then 'Delete button pressed by mistake -- no entries to delete
            MessageBox.Show("There are no time period entries to delete", "Selection error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            checkAdd()
            Return
        End If
        If (rdoTSingle.Checked = True) Then 'Deletes a single date
            DistTimePer.Remove(1)
            lboxTime.Items.Clear()
            checkAdd()
            Return
        End If
        If (rdoTRange.Checked = True) Then 'Deletes a range
            DistTimePer.Remove(2)
            DistTimePer.Remove(1)
            lboxTime.Items.Clear()
            checkAdd()
            Return
        End If
        iToRemove = lboxTime.SelectedIndex 'zero-based index
        If (iToRemove = -1) Then
            Dim sDelError As String = "No time period selected for deletion"
            MessageBox.Show(sDelError, "Selection error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            checkAdd()
            Return
        End If
        DistTimePer.Remove(iToRemove + 1)
        lboxTime.Items.RemoveAt(iToRemove)
        checkAdd()
    End Sub

    Private Sub rdoTSingle_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdoTSingle.Click
        Dim iCount As Integer = DistTimePer.Count
        Dim iLoop As Integer = 0
        Dim dSingle As New SngDateTime
        Dim gSingle As New GeolAge
        Dim strNewDate As String = ""

        'process Gregorian date/time
        pnlDates.Enabled = True
        If (rdoTSingle.Checked = True And iCount > 1) Then 'bring collection & list into conformance with being Single
            dSingle = CType(DistTimePer(1), SngDateTime)
            strNewDate = dSingle.SngDate & "  " & dSingle.TimeOfDay
            DistTimePer = New Collection
            DistTimePer.Add(dSingle)
            lboxTime.Items.Clear()
            lboxTime.Items.Add(strNewDate)
        End If
        checkAdd()
    End Sub

    Private Sub rdoTMult_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdoTMult.Click
        Dim iCount As Integer = DistTimePer.Count
        Dim iLoop As Integer = 0
        Dim strNewDate As String = ""
        Dim strNewDate2 As String = ""

        'process Gregorian date/time
        pnlDates.Enabled = True
        If (rdoTMult.Checked = True And iCount = 2) Then
            Dim dBegin As New SngDateTime
            Dim dEnding As New SngDateTime
            dBegin = CType(DistTimePer(1), SngDateTime)
            dEnding = CType(DistTimePer(iCount), SngDateTime)
            strNewDate = dBegin.SngDate & "  " & dBegin.TimeOfDay
            strNewDate2 = dEnding.SngDate & "  " & dEnding.TimeOfDay
            lboxTime.Items.Clear()
            lboxTime.Items.Add(strNewDate)
            lboxTime.Items.Add(strNewDate2)
        End If
        checkAdd()
    End Sub

    Private Sub rdoTRange_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdoTRange.Click
        Dim iCount As Integer = DistTimePer.Count
        Dim iLoop As Integer = 0
        Dim strNewDate As String = ""

        'process Gregorian date/time
        pnlDates.Enabled = True
        If (rdoTRange.Checked = True And iCount > 0) Then
            Dim dBegin As New SngDateTime
            Dim dEnding As New SngDateTime
            dBegin = CType(DistTimePer(1), SngDateTime)
            dEnding = CType(DistTimePer(iCount), SngDateTime)
            strNewDate = "begin: " & dBegin.SngDate & "  " & "end: " & dEnding.SngDate
            DistTimePer = New Collection
            DistTimePer.Add(dBegin)
            DistTimePer.Add(dEnding)
            lboxTime.Items.Clear()
            lboxTime.Items.Add(strNewDate)
        End If
        checkAdd()
    End Sub

#End Region

    Private Sub btnOK1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK1.Click
        If (oCurContact.PrimaryPerson = True) Then
            If (oCurContact.Person = "") Then
                MessageBox.Show("Contact info for distributor is incomplete", "Incomplete information", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Me.TabControl1.SelectedTab = TabPage1
                Return
            End If
        Else
            If (oCurContact.Organization = "") Then
                MessageBox.Show("Contact info for distributor is incomplete", "Incomplete information", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Me.TabControl1.SelectedTab = TabPage1
                Return
            End If
        End If
        If (txtLiable.Text = "") Then
            MessageBox.Show("Liability needs description", "Incomplete information", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Me.TabControl1.SelectedTab = TabPage1
            Return
        End If
        'required elements are present, update distributor
        With oCurDistrib
            .Distributor = oCurContact
            .ResourceDesc = txtResDesc.Text
            .Liability = txtLiable.Text
            .StdOrderColl = cStdOrderIndex
            .CustomOrder = txtCustom.Text
            .TechReq = txtPrereq.Text
            If (rdoTSingle.Checked = True) Then
                .boolSingle = True
                .boolRange = False
            ElseIf (rdoTMult.Checked = True) Then
                .boolSingle = True
                .boolRange = True
            ElseIf (rdoTRange.Checked = True) Then
                .boolSingle = False
                .boolRange = True
            Else
                'no Available Time Period provided
                .boolSingle = False
                .boolRange = False
            End If
            .TimeAvail = DistTimePer
            If (DistTimePer.Count = 0) Then
                'no Available Time Period provided
                .boolSingle = False
                .boolRange = False
            End If
        End With
        bUpdate = True
        Me.Close()
    End Sub

    Private Sub btnCancel1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel1.Click
        bUpdate = False
        Me.Close()
    End Sub

    Private Sub btnOK2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK2.Click
        btnOK1_Click(sender, e)
    End Sub

    Private Sub btnCancel2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel2.Click
        btnCancel1_Click(sender, e)
    End Sub

    Private Sub btnOK3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK3.Click
        btnOK1_Click(sender, e)
    End Sub

    Private Sub btnCancel3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel3.Click
        btnCancel1_Click(sender, e)
    End Sub

    Private Sub lboxTime_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lboxTime.SelectedIndexChanged
        If lboxTime.SelectedItems.Count() > 0 Then btnTimeEdit.Enabled = True : btnTimeDelete.Enabled = True Else btnTimeEdit.Enabled = False : btnTimeDelete.Enabled = False
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        button_example_Click(sender, e)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        button_example_Click(sender, e)
    End Sub

    Private Sub button_example_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_example.Click
        Dim helpForm As dialog_help = New dialog_help("Distribution")
        helpForm.ShowDialog()
    End Sub
End Class
